package com.example.gulimall.product.feign;

import com.example.common.to.SkuReductionTo;
import com.example.common.to.SpuBoundTo;
import com.example.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

@FeignClient("gulimall-coupon")
public interface CouponFeignService {
    /**
     * 1 , CouponFeignService.saveSpuBouds(spuBoundTo)
     *      1, @RequestBody将发送的数据spuBoundTo对象转换成json，并放到请求体里去
     *      2，找到gulimall_coupon服务，给/coupon/spubounds/save发送请求
     *      3，对方服务接收到请求，请求体里有json数据
     *          （@RequestBody SpuBoundsEntity spuBoundsEntity）：将请求体的json转换成SpuBoundsEntity对象
     *只要json数据模型是兼容的，双方服务无需使用同一个to，其实就是类似发了一次http请求
     * @param spuBoundTo
     * @return
     */
    @PostMapping("/coupon/spubounds/save")
    R saveSpuBouds(@RequestBody SpuBoundTo spuBoundTo);

    @PostMapping("/coupon/skufullreduction/saveinfo")
    R saveSkuReduction(@RequestBody  SkuReductionTo skuReductionTo);
}
